Repository navigation
Conversation
Accounts created before users.passwords.externalAuthValue changed still have the old marker stored, encoded or not, and the encoder only recognized the current marker and the default, so the old marker matched at login. The new users.passwords.externalAuthValue.previous setting lists earlier markers, which are refused at login and can't be chosen as passwords, the same as the current one. Empty entries are ignored so an empty password never counts as a marker.
…rker BCrypt gives some passwords other than a marker the same hash as the marker, so an exact comparison with the marker isn't enough to keep it from matching. After the delegate matches, the encoder now also checks whether the current, default or a previous marker matches the stored value, and refuses the password if one does. The marker list is read once per check.
An account whose real password equals the current, default or a previous marker can't log in, and until now the log didn't say why. The encoder now logs an info line for that refusal, without the password, so an administrator can tell it from a wrong password and set a new one.
The list is comma-separated, so a marker that contains a comma can't be listed there. roller.properties now says so, along with listing earlier values in the same restart that changes the setting and the accounts that need an administrator to set a new password. Roller also logs a warning at startup when the configured marker contains a comma.
…coder ExternalLoginMarkerPasswordTest now checks that registration, the profile page and user administration refuse a marker listed in users.passwords.externalAuthValue.previous, and its tearDown restores the configuration in a finally block. The provider tests for previous markers also check the encoder directly, and the list test covers spaces around an entry.
| // BCrypt, for one, treats some other passwords as equal to a | ||
| // marker, so refuse any password whose stored value a marker | ||
| // matches too | ||
| for (String marker : markers) { |
There was a problem hiding this comment.
🐞Claude Issue: Important: Each successful login now runs one more delegate match for every marker. With BCrypt, that is one more full hash for each marker: 2 in total with the default setting, 3 or more with a custom marker or a .previous list. A BCrypt collision with a marker shorter than 71 bytes needs a password that contains NUL. Otherwise the password must be at least 72 UTF-8 bytes long (truncation). So the loop can run only in those cases, for example:
String raw = rawPassword.toString();
if (raw.indexOf('\0') >= 0 || raw.getBytes(StandardCharsets.UTF_8).length >= 72) {
for (String marker : markers) { ... }
}The tests still cover this, because sameKey contains NUL. The same change applies to ExternalLoginAwarePasswordEncoder on 6.1.x.
|
|
||
| @Override | ||
| public boolean matches(CharSequence rawPassword, String encodedPassword) { | ||
| if (rawPassword == null || rawPassword.length() == 0) { |
There was a problem hiding this comment.
🐞Claude Issue: Important: The 6.1.x twin (#306) also returns false for a null or empty encodedPassword before the delegate sees it ("the delegate can throw for a missing or empty stored value"). Here, without lazyUpgradeFrom, DelegatingPasswordEncoder throws IllegalArgumentException for a stored value with no {id}. That makes the login fail with an error instead of a bad-credentials result. Add the same guard so both branches behave the same:
if (rawPassword == null || rawPassword.length() == 0
|| encodedPassword == null || encodedPassword.isEmpty()) {
return false;
}
A follow-up to #304, from Dave's review of its 6.1.x twin #306.
When an admin changes
users.passwords.externalAuthValue, accounts created earlier still store the old marker, encoded or not, and Roller only recognized the current marker and the default<externalAuth>.users.passwords.externalAuthValue.previoussetting takes a comma-separated list of earlier markers. They're refused at login and can't be chosen as passwords, the same as the current one. Empty entries are ignored, so an empty password field never counts as a marker.ExternalLoginPlaceholderTest covers an earlier marker stored encoded and unencoded, empty and spaced entries in the list, and a password that BCrypt treats as equal to the current, default or a previous marker. ExternalLoginMarkerPasswordTest checks that registration, the profile page and user administration refuse a previous marker. #306 has the same change for 6.1.x.